/* Floating Chat Button */
.chatbot-btn {
    position: fixed;
    bottom: 30px;
    /* logical property for direction-aware positioning */
    inset-inline-end: 12px; /* LTR: left, RTL: right */
    background-color: var(--primary-color, #4f46e5);
    color: white;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1052;
    font-size: 26px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25),
    0 0 15px var(--primary-color),
    0 0 25px var(--primary-dark);
}

/* Flip button based on page direction */
html[dir="ltr"] .chatbot-btn {
    inset-inline-end: 22px; /* left for LTR */
}

html[dir="rtl"] .chatbot-btn {
    inset-inline-end: auto;
    inset-inline-start: 22px; /* right for RTL */
}

/* Chat Box (popup) stays at same side as button */
.chatbot-box {
    position: fixed;
    bottom: 150px;
    display: none;
    z-index: 99998;
    border-radius: 12px;
    background: transparent;
    pointer-events: auto;
    transition: all 0.3s ease;
}

/* Flip chatbox based on direction */
html[dir="ltr"] .chatbot-box {
    left: 22px; /* show on left */
    right: auto;
}

html[dir="rtl"] .chatbot-box {
    right: 22px; /* show on right */
    left: auto;
}

/* Chat iframe */
.chatbot-box iframe {
    width: 420px;
    height: 70vh;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    pointer-events: auto;
}

/* Mobile View */
@media (max-width: 768px) {
    .chatbot-box {
        top: 0;
        bottom: 170px;
        width: 100%;
        height: auto;
        border-radius: 0;
    }

    .chatbot-box iframe {
        width: 100%;
        height: calc(100vh - 200px);
        border-radius: 0;
        border: none;
    }


    /* Flip chatbox based on direction */
    html[dir="ltr"] .chatbot-box {
        left: 0;
        right: 0;
    }

    html[dir="rtl"] .chatbot-box {
        left: 0;
        right: 0;
    }
}
